import {applyMiddleware,compose, createStore} from "redux";
import createSagaMiddleware from 'redux-saga';
import thunk from 'redux-thunk';
import reducer from './reducer';
import rootSaga from './rootSaga';

const composeEnhancers = (window as any).__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;
const sagaMiddleware = createSagaMiddleware();
const enhancer = composeEnhancers(applyMiddleware(sagaMiddleware, thunk));
const store = createStore(reducer, enhancer);
sagaMiddleware.run(rootSaga);
export default store;